<?php 
class LoginController extends Controller{
	/**
	 * 登录
	 */
	public function actionIndex(){
		if(!Yii::app()->user->isGuest)
			return $this->showError('你已经登录啦');
		$model = 'Member';
		$member = new $model('login');
		
		if(isset($_POST[$model])){
			$member->attributes = $_POST[$model];
			if($member->login()){
				return $this->redirect(Yii::app()->baseUrl);
			}
		}
		$this->render('index', array(
			'member' => $member
		));
	}
}
?>